package algorithm;

public class Test {

	public static void main(String[] args) {
		int[] array = new int[] { 1, 5, 7, 2, 4, 8, 3, 9, 6 };
		long s = System.nanoTime();
		// InsertionSort.insertionSort(array);
		// InsertionSort.insertionSort(array, array.length - 1);
		MergeSort.mergeSort(array);
		// BubbleSort.bubbleSort(array);
		long e = System.nanoTime();
		for (int i : array)
			System.out.println(i);
		System.out.println(format(78912345L));
	}

	public static String format(long l) {
		String s = String.valueOf(l);
		StringBuilder r = new StringBuilder();
		byte[] b = s.getBytes();
		for (int i = b.length - 1, j = 0; i >= 0;) {
			if (j > 0 && j % 3 == 0) {
				r.insert(0, ',');
			} else {
				r.insert(0, (char) b[i]);
				i--;
				j++;
			}
		}
		return r.toString();
	}

}
